
(in-package :toygen)

(defclass Sample1EvaluatorSite (EvaluatorSiteBase)
  (
    (indent
      :documentation "current indentation"
      :initform 0
      :accessor indent
      )
    )
  )

(defun s1-print-indent (site)
  (dotimes (i (indent site)) (format t " "))
  )

(defmethod process-atom ((site Sample1EvaluatorSite) atom)
  (s1-print-indent site)
  (format t "~a~%" atom)
  )

(defmethod pre-process-function ((site Sample1EvaluatorSite)
                                  func args)
  (s1-print-indent site)
  (format t "{~a~%" func)
  (incf (indent site)) ; incf returns new value of indent
  )

(defmethod post-process-function ((site Sample1EvaluatorSite)
                                   func args pre-process-result)
  (setf (indent site) (- pre-process-result 1))
  (s1-print-indent site)
  (format t "}~%")
  )
